import { App } from 'vue'

export function priceFormat(app: App) {
  app.directive('FPrice', {
    mounted(el, bindings: any) {
      const elText = el.textContent
      let priceUnit = bindings.value
      if (!priceUnit) priceUnit = '$'
      const formatPrice = elText + priceUnit
      const strong = document.createElement('strong')
      strong.textContent = priceUnit
      strong.style.fontSize = '18px'
      strong.style.fontWeight = '500'
      el.appendChild(strong)
    }
  })
}
